const { remote } = require('electron');
const win = remote.getCurrentWindow();
global.nodeRequire = require;

global.dialog = {
  selectFolder: () => {
    return remote.dialog.showOpenDialog(win, {
      properties: ['openDirectory']
    }).then(result => {
      return result.filePaths[0];
    });
  }
};

global.win = {
  getPositionX: () => {
    return win.getBounds().x;
  },

  getPositionY: () => {
    return win.getBounds().y;
  },

  getWidth: () => {
    return win.getBounds().width;
  },

  getHeight: () => {
    return win.getBounds().height;
  },

  isMaximizedx: () => {
    return win.isMaximized();
  },

  isMinimizedx: () => {
    return win.isMinimized();
  },

  resize: (x, y, width, height) => {
    win.setBounds({ x, y, width, height });
  },

  on: (event, cb) => {
    win.on(event, cb);
  },

  close: () => {
    win.close();
  },

  maximize: () => {
    win.maximize();
  },

  minimize: () => {
    win.minimize();
  },

  setResizable: (value) => {
    win.setResizable(value);
  }
};


